from csagent.core.node.base_node import BaseNode
from csagent.core.context import AgentState
import time
class Node(BaseNode):
    def initialize(self):
        """初始化节点"""
        print(self.conf)
        print('[推荐融合]merge Node初始化成功')
    def execute(self, state: AgentState, stream_writer=None) -> AgentState:
        print(f"[推荐融合]merge node开始执行")
        query = state['messages'][-1]['content']
        print("[推荐融合]推荐结果聚合中......")
        time.sleep(1)
        state['extra']['recommend'] = {}
        state['extra']['recommend']['drug'] = state['node_context']['drug_recommend']
        state['extra']['recommend']['food'] = state['node_context']['food_recommend']
        print(f"[推荐融合]merge node执行完成")
        return state